package model.map;

import model.entity.Avatar;

/**
 * This class tells the game map what state each of its
 * tiles should be in.
 * @author Zachary
 */
public class AvatarStateObserver {
	private GameMap gameMap;
	
	private AvatarStateVisitor asvr;
	
	/**
	 * Constructor for AvatarStateObserver.
	 * @param avatar
	 * @param gameMap
	 */
	public AvatarStateObserver(Avatar avatar, GameMap gameMap, String graphicShroudedID) {
		MapTileState.setAvatar(avatar);
		MapTileState.setShroudedGraphicID(graphicShroudedID);
		this.gameMap = gameMap;
		this.asvr = new AvatarStateVisitor(avatar);
	}
	
	/**
	 * Notify the ASO when the Avatar's state changes.
	 */
	public void updateState(){
		gameMap.acceptMapVisitor(asvr);
	}
}
